import Taro from '@tarojs/taro';
const Fly = require('flyio/dist/npm/wx');

const fly = new Fly();

fly.config.baseURL = 'https://cnodejs.org/api/v1';

fly.interceptors.request.use(request => {
  Taro.showLoading({
    title: '加载中...'
  });
  return request;
});

fly.interceptors.response.use(
  response => {
    Taro.hideLoading();
    return response.data;
  },
  err => {
    Taro.hideLoading();
  }
);

export default fly;